package link_list

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func init() {
	copy()
	in := bufio.NewScanner(os.Stdin)
	in.Buffer(nil, math.MaxInt32)
	_out, _ := os.Create("user.out")
	out := bufio.NewWriter(_out)
	for in.Scan() {
		s := in.Bytes()
		ans, c := 0, 0
		for _i := 1; _i < len(s); _i++ {
			_neg := false
			if s[_i] == '-' {
				_i++
				_neg = true
			}
			v := int(s[_i] & 15)
			for _i++; s[_i]&15 < 10; _i++ {
				v = v*10 + int(s[_i]&15)
			}
			if _neg {
				v = -v
			}
			if c == 0 {
				ans = v
			}
			if ans == v {
				c++
			} else {
				c--
			}
		}
		fmt.Fprintln(out, ans)
	}
	out.Flush()
	os.Exit(0)
}

func majorityElement([]int) (_ int) { return }
